package com.masterclient.app.modules.order.adapter;

import android.graphics.Color;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.masterclient.app.R;

import java.util.List;

/**
 * @auther hjian
 * @date 2020/11/5.
 */
public class SaleOrdersFilterAdapter extends BaseQuickAdapter<String, BaseViewHolder> {

    private int selectIndex = 0;

    public int getSelectIndex() {
        return selectIndex;
    }

    public void setSelectIndex(int selectIndex) {
        this.selectIndex = selectIndex;
        notifyDataSetChanged();
    }

    public SaleOrdersFilterAdapter(List<String> data) {
        super(R.layout.item_sale_orders_filter,data);
    }

    @Override
    protected void convert(BaseViewHolder helper, String item) {
        helper.setText(R.id.item_sale_orders_filter_name, item)
                .setTextColor(R.id.item_sale_orders_filter_name, Color.parseColor(selectIndex==
                        helper.getAdapterPosition()?"#FF6809":"#141922"))
                .setBackgroundRes(R.id.item_sale_orders_filter_name,selectIndex==
                        helper.getAdapterPosition()?R.drawable.shape_round_fff3ec:R.drawable.shape_round_f0f2f5);
    }
}
